<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{php echo $this->title;}</title>
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link rel="stylesheet" href="../addons/dashen_zaoqizhuanqian/css/idangerous.swiper.css?Hz2">
    <link rel="stylesheet" href="../addons/dashen_zaoqizhuanqian/css/animation.css?Hz2">
    <link rel="stylesheet" href="../addons/dashen_zaoqizhuanqian/css/style.css?Hz2">
    <script src="../addons/dashen_zaoqizhuanqian/js/jquery-1.9.1.min.js?Hz2" type="text/javascript"></script>
	<script src="../addons/dashen_zaoqizhuanqian/js/jquery.form.js?Hz2" type="text/javascript"></script>
    <script src="../addons/dashen_zaoqizhuanqian/js/rem.js?Hz2" type="text/javascript"></script>
    <script src="../addons/dashen_zaoqizhuanqian/js/fastclick.js?Hz2" type="text/javascript"></script>
    <script src="../addons/dashen_zaoqizhuanqian/js/jquery.similar.msgbox.js" type="text/javascript"></script>
    <script src="../addons/dashen_zaoqizhuanqian/js/idangerous.swiper.min.js" type="text/javascript"></script>
    <script src="../addons/dashen_zaoqizhuanqian/js/common.js" type="text/javascript"></script>   
</head>
<style>
       html, body, div, span, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, big, cite, code, del, em, font, img, ins, small, strong, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, input, textarea, select {
        margin:0;
        padding:0;
        box-sizing: border-box;
    }
    html{
        height:100%;
    }
    body{background:font-size: 0.2rem; font-family: "微软雅黑"; color: #666;/*background:  url("../addons/dashen_zaoqizhuanqian/images/yqbg2.jpg");background-size: 100% 100%;*/;}
    .box1{background-size: 100% 100%; width: 100%; text-align:center;}
	.top{ width:2.4rem; margin:0.4rem auto;}
    .bottom p,.message{font-size: 0.3rem;color: #000; line-height:0.6rem; height:0.6rem;}
    .bottom{ width: 100%; text-align: center; }
	.CreateImage{border:none; }
	.disable{background-color:#ccc;border-radius:3px;height:0.98rem;line-height:0.98rem;color:#fff;text-align:center;width:90%;margin:0 auto;margin-top:0.7rem;font-size:0.28rem;font-weight:bold;}
	.fixhb_load{display:none;width:100%;height:100%;position:fixed;z-index:9999;top:0;left:0; background-color:#fff;}
	.haibao{width: 100%; height: 100%; position: absolute;top:0; left:0; display:none;}
	.hb_img{width:100%; height:100%}
</style>
<body>
{if $is_fenxiao==1}
    <div class="box1">
    	{if $is_file==0}
        <img src="" class="haibao"/>
        <div class="fixhb_load">
            <div class="top">
                <img src="../addons/dashen_zaoqizhuanqian/images/loading.gif"/ >
            </div>
            <div class="bottom">
                <p>海报正在生成，大约需要60秒时间</p>
                <p>海报生成后，会发送至您的微信</p>
                <p>您现在可以返回首页</p>
                <p><a href="./index.php?i=<?php echo $uniacid?>&c=entry&do=index&m=dashen_zaoqizhuanqian" class="ComminSubmit" style="font-size:0.3rem; padding:0.1rem 0.3rem;">回首页</a></p>
            </div>
        </div>
        <div class="hb_error">
            <div class="top">
                <img src="../addons/dashen_zaoqizhuanqian/images/ku.gif"/ >
            </div>
            <div class="bottom">
                <p>您还没有海报</p>
                <p>邀请一位好友关注，可获得好友挑战奖励</p>
                <p>邀请越多，收获越多</p>
                <p>点击生成海报，马上生成哟！</p>
                <p><input type="button" class="ComminSubmit CreateImage" value="生成海报"/></p>
            </div>
        </div>
        {else}
        <div class="hb_img">
            <img src="{$file}"/>
        </div>
       <!-- <input type="button" class="ComminSubmit CreateImage" value="重新生成海报"/>-->
        {/if}

    </div>
	
	<script>
	var Config = new Object();
	Config.MsgBox_ok = '确定';
	Config.MsgBox_no = '取消';
    $(document).on('click',".CreateImage",function() {
		var uniacid = <?php echo $uniacid?>;
		$('.CreateImage').attr('disabled',true);
		$(".CreateImage").addClass("disable");
		$(".CreateImage").removeClass("ComminSubmit");
		$.ajax({
			url: './index.php?i='+uniacid+'&c=entry&do=CreateImage&m=dashen_zaoqizhuanqian',
			type: 'get',
			dataType:'json',
			contentType: "application/x-www-form-urlencoded; charset=utf-8",
			beforeSend:function(XMLHttpRequest){
				$('.hb_error').hide();
				$('.fixhb_load').show();
			},
			success:function(Data){
				$('.fixed_load').hide();
				if(Data.State == 200 || Data.State == 202){//图片生成成功
					$('.fixhb_load').hide();
					$('.haibao').attr('src',Data.src);
					$('.haibao').show();
				}
				else{
					$.MsgBox.Alert('消息','图片生成失败');
				}
			},
			error:function(XMLHttpRequest){
				$('.fixed_load').hide();
				$.MsgBox.Alert('消息',"请求失败，错误状态为："+XMLHttpRequest.status);
			}
		});
    });
    </script>
{else}
<div class="box1">
	<div class="top">
     	<img src="../addons/dashen_zaoqizhuanqian/images/ku.gif"/ >
    </div>
    <div class="bottom">
        <p>很抱歉！</p>
        <p>您现在没有邀请资格</p>
        <p>挑战金处用可用状态才具备邀请资格！</p>
        <p><a href="./index.php?i=<?php echo $uniacid?>&c=entry&do=index&m=dashen_zaoqizhuanqian" class="ComminSubmit" style="font-size:0.3rem; padding:0.1rem 0.3rem;">回首页</a></p>
    </div>
</div>
{/if}


<script>
    wx.ready(function () {
        sharedata = {
            title: "<?php echo $share['share_title']?>",
            desc:  "<?php echo $share['share_desc']?>",
            link:  "{php echo $_W['siteroot'].str_replace('./','app/',$this->createmobileurl('index')).'&fid='.$uid;}",
            imgUrl: "<?php echo $share['share_pic']?>"
        };
        wx.onMenuShareAppMessage(sharedata);
        wx.onMenuShareTimeline(sharedata);
        wx.onMenuShareQQ(sharedata);
        wx.onMenuShareQZone(sharedata);
        wx.onMenuShareWeibo(sharedata);
    });
</script>
</body>
</html>